#include <QApplication>
#include <QSqlDatabase>
#include <QSqlQuery>

static bool createConnection() {
	    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
	        db.setDatabaseName("test.db");
		    if (!db.open()) return false;

		        QSqlQuery query;
			    query.exec("create table person (id int primary key, "
					                   "firstname varchar(20), lastname varchar(20))");
			        query.exec("insert into person values(101, 'Danny', 'Young')");
				    // 更多插入语句...
				         return true;
				         }
				    
				         int main(int argc, char *argv[]) {
				             QApplication app(argc, argv);
				                 if (!createConnection()) return 1;
				                     return 0;
				                     }
